import 'package:flutter/cupertino.dart';
import 'package:full_display/common/qxp_color.dart';

class TabBarCustomBg extends CustomPainter {
  @override
  void paint(Canvas canvas, Size size) {
    final paint = Paint()
      ..isAntiAlias = true
      ..style = PaintingStyle.stroke
      ..strokeWidth = 1
      ..shader = const LinearGradient(
        colors: [ColorPlate.tabbar_select, ColorPlate.tabbar_gradient],
        begin: Alignment.topCenter,
        end: Alignment.bottomCenter,
      ).createShader(Rect.fromLTWH(0, 0, size.width, size.height));

    final rect = RRect.fromLTRBR(
        0, 0, size.width, size.height, const Radius.circular(20));
    canvas.drawRRect(rect, paint);

    final transparentPaint = Paint()..color = ColorPlate.transparent;

    final transparentRect = RRect.fromLTRBR(
        1, 1, size.width - 1, size.height - 1, const Radius.circular(10));

    canvas.drawRRect(transparentRect, transparentPaint);
  }

  @override
  bool shouldRepaint(CustomPainter oldDelegate) => false;
}
